#ifndef _DSCREENHANDLER_H
#define _DSCREENHANDLER_H

//==============================================================================
//
//     DScreenHandler - the protocol for classes that handle screen events
//
//               Copyright (C) 2005  Dick van Oudheusden
//  
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
// 
//  $Date: 2005-07-31 14:11:27 $ $Revision: 1.1 $
//
//==============================================================================

#include "ofc/DKey.h"

#define DSH_KEY_NONE             (0) // Nothing
#define DSH_KEY_DOWN             (1) // Key down
#define DSH_KEY_UP               (2) // Key up
#define DSH_KEY_PRESS            (3) // Key pressed

#define DSH_BUTTON_NONE          (0) // Nothing
#define DSH_BUTTON_DOWN          (1) // Button down
#define DSH_BUTTON_UP            (2) // Button up
#define DSH_BUTTON_CLICK         (3) // Button clicked
#define DSH_BUTTON_DOUBLE_CLICK  (4) // Button double clicked
#define DSH_BUTTON_TRIPLE_CLICK  (5) // Button triple clicked

//
// The DScreenHandler protocol specifies methods that should be implemented by
// classes that receive events from a screen.
//

@protocol DScreenHandler

//
// Process the event that a key is pressed
//
// @param key     the key
// @param state   the state (DSH_KEY_..)
// 
// @return continue processing events ?
//
  - (BOOL) keyPress :(DKey *) key :(int) state;

//
// Process the event that the mouse is moved
// 
// @param x       the x position of the mouse
// @param y       the y position of the mouse
// 
// @return continue processing events ?
// 
- (BOOL) mouseMove :(unsigned) x :(unsigned) y;

//
// Process the event that a mouse button is pressed
// 
// @param button  the button
// @param state   the state (DSH_BUTTON_..)
// 
// @return continue processing events ?
// 
- (BOOL) mouseButtonPress :(DKey *) button :(int) state;

//
// Process the event that the screen is resized
// 
// @param maxX    the new maximum value for x
// @param maxY    the new maximum value for y
// 
// @return continue processing events ?
// 
- (BOOL) screenResize :(unsigned) maxX :(unsigned) maxY;
  
//
// Process the event that the screen changed focus
// 
// @param focus   the focus status
// 
// @return continue processing events ?
// 
- (BOOL) screenFocus :(BOOL) focus;

//
// Process the event that the screen should be redrawn
// 
// @param minX    the minimum value for x
// @param maxX    the maximum value for x
// @param minY    the minimum value for y
// @param maxY    the maximum value for y
// 
// @return continue processing events ?
// 
- (BOOL) screenRedraw :(unsigned) minX :(unsigned) maxX :(unsigned) minY :(unsigned) maxY;

@end

#endif

